import salseApi from "@/api/declaration/erp/salseApi"
import httpRequest from "@/config/axios/httpRequest"
import { SaleReturnModel } from "@/models/erp/SaleReturnModel"


// ERP 销售退货 API
export const SaleReturnApi = {
  // 查询销售退货分页
  getSaleReturnPage: async (params: any) => {
    return await httpRequest.get(salseApi.GetSaleReturnPage, { params })
  },

  // 查询销售退货详情
  getSaleReturn: async (id: number) => {
    return await httpRequest.get(salseApi.GetSaleReturn, { params: { id } })
  },

  // 新增销售退货
  createSaleReturn: async (data: SaleReturnModel) => {
    return await httpRequest.post(salseApi.CreateSaleReturn, data)
  },

  // 修改销售退货
  updateSaleReturn: async (data: SaleReturnModel) => {
    return await httpRequest.put(salseApi.UpdateSaleReturn, data)
  },

  // 更新销售退货的状态
  updateSaleReturnStatus: async (id: number, status: number) => {
    return await httpRequest.put(salseApi.UpdateSaleReturnStatus, { id, status })
  },

  // 删除销售退货
  deleteSaleReturn: async (ids: number[]) => {
    return await httpRequest.delete(salseApi.DeleteSaleReturn, { data: ids })
  },

  // 导出销售退货 Excel
  exportSaleReturn: async (params: any) => {
    return await httpRequest.download(salseApi.ExportSaleReturn, params)
  }
}
